import time

from multiprocessing import Process
from threading import Thread


def func(a, b):
    return a, b


if __name__ == '__main__':
    t1 = time.time()
    for i in range(500):
        Thread(target=func, args=(10, 20,)).start()
    t2 = time.time()

    t3 = time.time()
    for i in range(500):
        Process(target=func, args=(10, 20)).start()
    t4 = time.time()
    print(t2 - t1)  # 0.11300039291381836 执行500个线程
    print(t4 - t3)  # 8.965200901031494  执行500个进程
